package com.gengine.media.core.play
{
	import com.gengine.media.events.*;
	import com.gengine.media.interfaces.*;
	
	public class MediaPlayCore extends Object implements IMediaPlayCore
	{
		protected var _paused:Boolean = false;
		protected var _playing:Boolean = false;
		protected var _stopped:Boolean = true;
		protected var _url:String;
		protected var _mediaData:Object;
		protected var _volume:Number = 1;
		protected var _mute:Boolean = false;
		protected var _bufferTime:Number = 1000;
		protected var _buffering:Boolean = false;
		protected var _bufferPercentage:Number = 0;
		protected var _loadPercentage:Number = 0;
		protected var _playheadTime:Number = 0;
		protected var _totalTime:Number = 0;
		protected var _callback:Object;
		
		public function MediaPlayCore(param1:String = null, param2:Number = 1000, param3:Object = null)
		{
			this._url = param1;
			this._bufferTime = param2;
			this._callback = param3;
			
		}
		
		public function get paused() : Boolean
		{
			return this._paused;
		}
		
		public function get playing() : Boolean
		{
			return this._playing;
		}
		
		public function get stopped() : Boolean
		{
			return this._stopped;
		}
		
		public function get url() : String
		{
			return this._url;
		}
		
		public function get mediaData() : Object
		{
			return this._mediaData;
		}
		
		public function get volume() : Number
		{
			return this._volume;
		}
		
		public function set volume(param1:Number) : void
		{
			this._volume = param1;
			
		}
		
		public function get mute() : Boolean
		{
			return this._mute;
		}
		
		public function get bufferTime() : Number
		{
			return this._bufferTime;
		}
		
		public function get bufferPercentage() : Number
		{
			return this._bufferPercentage;
		}
		
		public function get loadPercentage() : Number
		{
			return this._loadPercentage;
		}
		
		public function get playheadTime() : Number
		{
			return this._playheadTime;
		}
		
		public function get totalTime() : Number
		{
			return this._totalTime;
		}
		
		public function get playheadPercentage() : Number
		{
			return this.totalTime == 0 ? (0) : (this.playheadTime / this.totalTime);
		}
		
		public function get buffering() : Boolean
		{
			return this._buffering;
		}
		
		public function play() : void
		{
			this._playing = true;
			var _loc_1:* = !this._playing;
			this._stopped = !this._playing;
			this._paused = _loc_1;
			
		}
		
		public function pause() : void
		{
			this._paused = true;
			var _loc_1:* = !this._paused;
			this._stopped = !this._paused;
			this._playing = _loc_1;
			
		}
		
		public function resume() : void
		{
			
		}
		
		public function stop() : void
		{
			this._stopped = true;
			var _loc_1:* = !this._stopped;
			this._paused = !this._stopped;
			this._playing = _loc_1;
			
		}
		
		public function seek(param1:Number = 0) : void
		{
			
		}
		
		public function seekPercent(param1:Number = 0) : void
		{
			
		}
		
		public function dispose() : void
		{
			if (this._callback)
			{
				if (this._callback.hasOwnProperty("onMediaEvent"))
				{
					this._callback.onMediaEvent = null;
				}
				this._callback = null;
			}
			
		}
		
		protected function callbackFunction(param1:String, param2:String = null) : void
		{
			if (this._callback)
			{
				if (this._callback.onMediaEvent)
				{
					this._callback.onMediaEvent(new MediaPlayEvent(param1, this, param2));
					;
				}
			}
			
		}
		
	}
}
